home *** CD-ROM | disk | FTP | other *** search
/ Personal Computer World 2009 February / PCWFEB09.iso / Software / Linux / SLAX 6.0.8 / slax-6.0.8.iso / slax / base / 006-devel.lzm / usr / include / rpm / rpmio.h < prev    next >
Encoding:
C/C++ Source or Header  |  2008-10-22  |  16.7 KB  |  720 lines

  1. #ifndef    H_RPMIO
  2. #define    H_RPMIO
  3.  
  4. /** \ingroup rpmio
  5.  * \file rpmio/rpmio.h
  6.  *
  7.  */
  8.  
  9. #include <sys/types.h>
  10. #include <sys/stat.h>
  11. #include <dirent.h>
  12. /*@-noparams@*/
  13. #include "glob.h"
  14. /*@=noparams@*/
  15. #include <stdio.h>
  16. #include <stdlib.h>
  17. #include <unistd.h>
  18.  
  19. /**
  20.  */
  21. typedef /*@abstract@*/ struct pgpDig_s * pgpDig;
  22.  
  23. /**
  24.  */
  25. typedef /*@abstract@*/ struct pgpDigParams_s * pgpDigParams;
  26.  
  27. /** \ingroup rpmio
  28.  * Hide libio API lossage.
  29.  * The libio interface changed after glibc-2.1.3 to pass the seek offset
  30.  * argument as a pointer rather than as an off_t. The snarl below defines
  31.  * typedefs to isolate the lossage.
  32.  */
  33. /*@{*/
  34. #if !defined(__LCLINT__) && defined(__GLIBC__) && \
  35.     (__GLIBC__ > 2 || (__GLIBC__ == 2 && __GLIBC_MINOR__ >= 2))
  36. #define USE_COOKIE_SEEK_POINTER 1
  37. typedef _IO_off64_t     _libio_off_t;
  38. typedef _libio_off_t *    _libio_pos_t;
  39. #else
  40. typedef off_t         _libio_off_t;
  41. typedef off_t         _libio_pos_t;
  42. #endif
  43. /*@}*/
  44.  
  45. /** \ingroup rpmio
  46.  */
  47. typedef    /*@abstract@*/ /*@refcounted@*/ struct _FD_s * FD_t;
  48.  
  49. /** \ingroup rpmio
  50.  */
  51. typedef /*@observer@*/ struct FDIO_s * FDIO_t;
  52.  
  53. #ifdef __cplusplus
  54. extern "C" {
  55. #endif
  56.  
  57. /** \ingroup rpmio
  58.  * \name RPMIO Vectors.
  59.  */
  60. /*@{*/
  61.  
  62. /**
  63.  */
  64. typedef ssize_t (*fdio_read_function_t) (void *cookie, char *buf, size_t nbytes)
  65.     /*@globals errno, fileSystem @*/
  66.     /*@modifies *cookie, errno, fileSystem @*/
  67.     /*@requires maxSet(buf) >= (nbytes - 1) @*/
  68.     /*@ensures maxRead(buf) == result @*/ ;
  69.  
  70. /**
  71.  */
  72. typedef ssize_t (*fdio_write_function_t) (void *cookie, const char *buf, size_t nbytes)
  73.     /*@globals errno, fileSystem @*/
  74.     /*@modifies *cookie, errno, fileSystem @*/;
  75.  
  76. /**
  77.  */
  78. typedef int (*fdio_seek_function_t) (void *cookie, _libio_pos_t pos, int whence)
  79.     /*@globals errno, fileSystem @*/
  80.     /*@modifies *cookie, errno, fileSystem @*/;
  81.  
  82. /**
  83.  */
  84. typedef int (*fdio_close_function_t) (void *cookie)
  85.     /*@globals errno, fileSystem, systemState @*/
  86.     /*@modifies *cookie, errno, fileSystem, systemState @*/;
  87.  
  88.  
  89. /**
  90.  */
  91. typedef /*@only@*/ /*@null@*/ FD_t (*fdio_ref_function_t) ( /*@only@*/ void * cookie,
  92.         const char * msg, const char * file, unsigned line)
  93.     /*@globals fileSystem @*/
  94.     /*@modifies fileSystem @*/;
  95.  
  96. /**
  97.  */
  98. typedef /*@only@*/ /*@null@*/ FD_t (*fdio_deref_function_t) ( /*@only@*/ FD_t fd,
  99.         const char * msg, const char * file, unsigned line)
  100.     /*@globals fileSystem @*/
  101.     /*@modifies fd, fileSystem @*/;
  102.  
  103.  
  104. /**
  105.  */
  106. typedef /*@only@*/ /*@null@*/ FD_t (*fdio_new_function_t) (const char * msg,
  107.         const char * file, unsigned line)
  108.     /*@globals fileSystem @*/
  109.     /*@modifies fileSystem @*/;
  110.  
  111.  
  112. /**
  113.  */
  114. typedef int (*fdio_fileno_function_t) (void * cookie)
  115.     /*@globals fileSystem @*/
  116.     /*@modifies *cookie, fileSystem @*/;
  117.  
  118.  
  119. /**
  120.  */
  121. typedef FD_t (*fdio_open_function_t) (const char * path, int flags, mode_t mode)
  122.     /*@globals errno, fileSystem @*/
  123.     /*@modifies errno, fileSystem @*/;
  124.  
  125. /**
  126.  */
  127. typedef FD_t (*fdio_fopen_function_t) (const char * path, const char * fmode)
  128.     /*@globals fileSystem @*/
  129.     /*@modifies fileSystem @*/;
  130.  
  131. /**
  132.  */
  133. typedef void * (*fdio_ffileno_function_t) (FD_t fd)
  134.     /*@globals fileSystem @*/
  135.     /*@modifies fileSystem @*/;
  136.  
  137. /**
  138.  */
  139. typedef int (*fdio_fflush_function_t) (FD_t fd)
  140.     /*@globals fileSystem @*/
  141.     /*@modifies fileSystem @*/;
  142. /*@}*/
  143.  
  144.  
  145. /** \ingroup rpmrpc
  146.  * \name RPMRPC Vectors.
  147.  */
  148. /*@{*/
  149.  
  150. /**
  151.  */
  152. typedef int (*fdio_mkdir_function_t) (const char * path, mode_t mode)
  153.     /*@globals errno, fileSystem @*/
  154.     /*@modifies errno, fileSystem @*/;
  155.  
  156. /**
  157.  */
  158. typedef int (*fdio_chdir_function_t) (const char * path)
  159.     /*@globals errno, fileSystem @*/
  160.     /*@modifies errno, fileSystem @*/;
  161.  
  162. /**
  163.  */
  164. typedef int (*fdio_rmdir_function_t) (const char * path)
  165.     /*@globals errno, fileSystem @*/
  166.     /*@modifies errno, fileSystem @*/;
  167.  
  168. /**
  169.  */
  170. typedef int (*fdio_rename_function_t) (const char * oldpath, const char * newpath)
  171.     /*@globals errno, fileSystem @*/
  172.     /*@modifies errno, fileSystem @*/;
  173.  
  174. /**
  175.  */
  176. typedef int (*fdio_unlink_function_t) (const char * path)
  177.     /*@globals errno, fileSystem @*/
  178.     /*@modifies errno, fileSystem @*/;
  179. /*@-typeuse@*/
  180.  
  181. /**
  182.  */
  183. typedef int (*fdio_stat_function_t) (const char * path, /*@out@*/ struct stat * st)
  184.     /*@globals errno, fileSystem @*/
  185.     /*@modifies *st, errno, fileSystem @*/;
  186.  
  187. /**
  188.  */
  189. typedef int (*fdio_lstat_function_t) (const char * path, /*@out@*/ struct stat * st)
  190.     /*@globals errno, fileSystem @*/
  191.     /*@modifies *st, errno, fileSystem @*/;
  192.  
  193. /**
  194.  */
  195. typedef int (*fdio_access_function_t) (const char * path, int amode)
  196.     /*@globals errno, fileSystem @*/
  197.     /*@modifies errno, fileSystem @*/;
  198. /*@=typeuse@*/
  199. /*@}*/
  200.  
  201.  
  202. /** \ingroup rpmio
  203.  */
  204. struct FDIO_s {
  205.   fdio_read_function_t        read;
  206.   fdio_write_function_t        write;
  207.   fdio_seek_function_t        seek;
  208.   fdio_close_function_t        close;
  209.  
  210.   fdio_ref_function_t        _fdref;
  211.   fdio_deref_function_t        _fdderef;
  212.   fdio_new_function_t        _fdnew;
  213.   fdio_fileno_function_t    _fileno;
  214.  
  215.   fdio_open_function_t        _open;
  216.   fdio_fopen_function_t        _fopen;
  217.   fdio_ffileno_function_t    _ffileno;
  218.   fdio_fflush_function_t    _fflush;
  219.  
  220.   fdio_mkdir_function_t        _mkdir;
  221.   fdio_chdir_function_t        _chdir;
  222.   fdio_rmdir_function_t        _rmdir;
  223.   fdio_rename_function_t    _rename;
  224.   fdio_unlink_function_t    _unlink;
  225. };
  226.  
  227.  
  228. /** \ingroup rpmio
  229.  * \name RPMIO Interface.
  230.  */
  231. /*@{*/
  232.  
  233. /**
  234.  * strerror(3) clone.
  235.  */
  236. /*@observer@*/ const char * Fstrerror(/*@null@*/ FD_t fd)
  237.     /*@*/;
  238.  
  239. /**
  240.  * fread(3) clone.
  241.  */
  242. /*@-incondefs@*/
  243. size_t Fread(/*@out@*/ void * buf, size_t size, size_t nmemb, FD_t fd)
  244.     /*@globals fileSystem @*/
  245.     /*@modifies fd, *buf, fileSystem @*/
  246.     /*@requires maxSet(buf) >= (nmemb - 1) @*/
  247.     /*@ensures maxRead(buf) == result @*/;
  248. /*@=incondefs@*/
  249.  
  250. /**
  251.  * fwrite(3) clone.
  252.  */
  253. /*@-incondefs@*/
  254. size_t Fwrite(const void * buf, size_t size, size_t nmemb, FD_t fd)
  255.     /*@globals fileSystem @*/
  256.     /*@modifies fd, fileSystem @*/
  257.     /*@requires maxRead(buf) >= nmemb @*/;
  258. /*@=incondefs@*/
  259.  
  260. /**
  261.  * fseek(3) clone.
  262.  */
  263. int Fseek(FD_t fd, _libio_off_t offset, int whence)
  264.     /*@globals fileSystem @*/
  265.     /*@modifies fileSystem @*/;
  266.  
  267. /**
  268.  * fclose(3) clone.
  269.  */
  270. int Fclose( /*@killref@*/ FD_t fd)
  271.     /*@globals fileSystem, internalState @*/
  272.     /*@modifies fd, fileSystem, internalState @*/;
  273.  
  274. /**
  275.  */
  276. /*@null@*/ FD_t    Fdopen(FD_t ofd, const char * fmode)
  277.     /*@globals fileSystem @*/
  278.     /*@modifies ofd, fileSystem @*/;
  279.  
  280. /**
  281.  * fopen(3) clone.
  282.  */
  283. /*@null@*/ FD_t    Fopen(/*@null@*/ const char * path,
  284.             /*@null@*/ const char * fmode)
  285.     /*@globals h_errno, fileSystem, internalState @*/
  286.     /*@modifies fileSystem, internalState @*/;
  287.  
  288.  
  289. /**
  290.  * fflush(3) clone.
  291.  */
  292. int Fflush(/*@null@*/ FD_t fd)
  293.     /*@globals fileSystem @*/
  294.     /*@modifies fd, fileSystem @*/;
  295.  
  296. /**
  297.  * ferror(3) clone.
  298.  */
  299. int Ferror(/*@null@*/ FD_t fd)
  300.     /*@*/;
  301.  
  302. /**
  303.  * fileno(3) clone.
  304.  */
  305. int Fileno(FD_t fd)
  306.     /*@globals fileSystem @*/
  307.     /*@modifies fileSystem@*/;
  308.  
  309. /**
  310.  * fcntl(2) clone.
  311.  */
  312. /*@unused@*/
  313. int Fcntl(FD_t fd, int op, void *lip)
  314.     /*@globals errno, fileSystem @*/
  315.     /*@modifies fd, *lip, errno, fileSystem @*/;
  316.  
  317. /*@}*/
  318.  
  319. /** \ingroup rpmrpc
  320.  * \name RPMRPC Interface.
  321.  */
  322. /*@{*/
  323.  
  324. /**
  325.  * mkdir(2) clone.
  326.  */
  327. int Mkdir(const char * path, mode_t mode)
  328.     /*@globals errno, h_errno, fileSystem, internalState @*/
  329.     /*@modifies errno, fileSystem, internalState @*/;
  330.  
  331. /**
  332.  * chdir(2) clone.
  333.  */
  334. int Chdir(const char * path)
  335.     /*@globals errno, h_errno, fileSystem, internalState @*/
  336.     /*@modifies errno, fileSystem, internalState @*/;
  337.  
  338. /**
  339.  * rmdir(2) clone.
  340.  */
  341. int Rmdir(const char * path)
  342.     /*@globals errno, h_errno, fileSystem, internalState @*/
  343.     /*@modifies errno, fileSystem, internalState @*/;
  344.  
  345. /**
  346.  * rename(2) clone.
  347.  */
  348. int Rename(const char * oldpath, const char * newpath)
  349.     /*@globals errno, h_errno, fileSystem, internalState @*/
  350.     /*@modifies errno, fileSystem, internalState @*/;
  351.  
  352. /**
  353.  * link(2) clone.
  354.  */
  355. int Link(const char * oldpath, const char * newpath)
  356.     /*@globals errno, fileSystem, internalState @*/
  357.     /*@modifies errno, fileSystem, internalState @*/;
  358.  
  359. /**
  360.  * unlink(2) clone.
  361.  */
  362. int Unlink(const char * path)
  363.     /*@globals errno, h_errno, fileSystem, internalState @*/
  364.     /*@modifies errno, fileSystem, internalState @*/;
  365.  
  366. /**
  367.  * readlink(2) clone.
  368.  */
  369. /*@-incondefs@*/
  370. int Readlink(const char * path, /*@out@*/ char * buf, size_t bufsiz)
  371.     /*@globals errno, h_errno, fileSystem, internalState @*/
  372.     /*@modifies *buf, errno, fileSystem, internalState @*/
  373.     /*@requires maxSet(buf) >= (bufsiz - 1) @*/
  374.     /*@ensures maxRead(buf) <= bufsiz @*/;
  375. /*@=incondefs@*/
  376.  
  377. /**
  378.  * stat(2) clone.
  379.  */
  380. int Stat(const char * path, /*@out@*/ struct stat * st)
  381.     /*@globals errno, h_errno, fileSystem, internalState @*/
  382.     /*@modifies *st, errno, fileSystem, internalState @*/;
  383.  
  384. /**
  385.  * lstat(2) clone.
  386.  */
  387. int Lstat(const char * path, /*@out@*/ struct stat * st)
  388.     /*@globals errno, h_errno, fileSystem, internalState @*/
  389.     /*@modifies *st, errno, fileSystem, internalState @*/;
  390.  
  391. /**
  392.  * access(2) clone.
  393.  */
  394. int Access(const char * path, int amode)
  395.     /*@globals errno, fileSystem @*/
  396.     /*@modifies errno, fileSystem @*/;
  397.  
  398. /**
  399.  * glob_pattern_p(3) clone.
  400.  */
  401. int Glob_pattern_p (const char *pattern, int quote)
  402.     /*@*/;
  403.  
  404. /**
  405.  * glob_error(3) clone.
  406.  */
  407. int Glob_error(const char * epath, int eerrno)
  408.     /*@*/;
  409.  
  410. /**
  411.  * glob(3) clone.
  412.  */
  413. int Glob(const char * pattern, int flags,
  414.         int errfunc(const char * epath, int eerrno),
  415.         /*@out@*/ glob_t * pglob)
  416.     /*@globals fileSystem @*/
  417.     /*@modifies *pglob, fileSystem @*/;
  418.  
  419. /**
  420.  * globfree(3) clone.
  421.  */
  422. void Globfree( /*@only@*/ glob_t * pglob)
  423.     /*@globals fileSystem @*/
  424.     /*@modifies *pglob, fileSystem @*/;
  425.  
  426.  
  427. /**
  428.  * opendir(3) clone.
  429.  */
  430. /*@null@*/
  431. DIR * Opendir(const char * path)
  432.     /*@globals errno, h_errno, fileSystem, internalState @*/
  433.     /*@modifies errno, fileSystem, internalState @*/;
  434.  
  435. /**
  436.  * readdir(3) clone.
  437.  */
  438. /*@dependent@*/ /*@null@*/
  439. struct dirent * Readdir(DIR * dir)
  440.     /*@globals errno, fileSystem @*/
  441.     /*@modifies *dir, errno, fileSystem @*/;
  442.  
  443. /**
  444.  * closedir(3) clone.
  445.  */
  446. int Closedir(/*@only@*/ DIR * dir)
  447.     /*@globals errno, fileSystem @*/
  448.     /*@modifies *dir, errno, fileSystem @*/;
  449.  
  450. /*@}*/
  451.  
  452.  
  453. /** \ingroup rpmio
  454.  * \name RPMIO Utilities.
  455.  */
  456. /*@{*/
  457.  
  458. /**
  459.  */
  460. off_t    fdSize(FD_t fd)
  461.     /*@globals fileSystem @*/
  462.     /*@modifies fd, fileSystem@*/;
  463.  
  464. /**
  465.  */
  466. /*@null@*/ FD_t fdDup(int fdno)
  467.     /*@globals fileSystem, internalState @*/
  468.     /*@modifies fileSystem, internalState @*/;
  469.  
  470. #ifdef UNUSED
  471. /*@null@*/ FILE *fdFdopen( /*@only@*/ void * cookie, const char * mode);
  472. #endif
  473.  
  474. /* XXX Legacy interfaces needed by gnorpm, rpmfind et al */
  475.  
  476. /*@-exportlocal@*/
  477. /**
  478.  */
  479. #ifndef H_RPMIO_INTERNAL    /* XXX avoid gcc warning */
  480. /*@unused@*/ int fdFileno(void * cookie)
  481.     /*@*/;
  482. #define    fdFileno(_fd)        fdio->_fileno(_fd)
  483. #endif
  484.  
  485. /**
  486.  */
  487. /*@null@*/ FD_t fdOpen(const char *path, int flags, mode_t mode)
  488.     /*@globals errno, fileSystem, internalState @*/
  489.     /*@modifies errno, fileSystem, internalState @*/;
  490. #define    fdOpen(_path, _flags, _mode)    fdio->_open((_path), (_flags), (_mode))
  491.  
  492. /**
  493.  */
  494. /*@-incondefs@*/
  495. ssize_t fdRead(void * cookie, /*@out@*/ char * buf, size_t count)
  496.     /*@globals errno, fileSystem, internalState @*/
  497.     /*@modifies *cookie, *buf, errno, fileSystem, internalState @*/
  498.     /*@requires maxSet(buf) >= (count - 1) @*/
  499.     /*@ensures maxRead(buf) == result @*/ ;
  500. #define    fdRead(_fd, _buf, _count)    fdio->read((_fd), (_buf), (_count))
  501. /*@=incondefs@*/
  502.  
  503. /**
  504.  */
  505. ssize_t    fdWrite(void * cookie, const char * buf, size_t count)
  506.     /*@globals errno, fileSystem, internalState @*/
  507.     /*@modifies *cookie, errno, fileSystem, internalState @*/;
  508. #define    fdWrite(_fd, _buf, _count)    fdio->write((_fd), (_buf), (_count))
  509.  
  510. /**
  511.  */
  512. int fdClose( /*@only@*/ void * cookie)
  513.     /*@globals errno, fileSystem, systemState, internalState @*/
  514.     /*@modifies *cookie, errno, fileSystem, systemState, internalState @*/;
  515. #define    fdClose(_fd)        fdio->close(_fd)
  516.  
  517. /**
  518.  */
  519. /*@unused@*/
  520. /*@only@*/ /*@null@*/
  521. FD_t fdLink (/*@only@*/ void * cookie, const char * msg)
  522.     /*@globals fileSystem @*/
  523.     /*@modifies *cookie, fileSystem @*/;
  524. #define    fdLink(_fd, _msg)    fdio->_fdref(_fd, _msg, __FILE__, __LINE__)
  525.  
  526. /**
  527.  */
  528. /*@unused@*/
  529. /*@only@*/ /*@null@*/
  530. FD_t fdFree(/*@only@*/ FD_t fd, const char * msg)
  531.     /*@globals fileSystem @*/
  532.     /*@modifies fd, fileSystem @*/;
  533. #define    fdFree(_fd, _msg)    fdio->_fdderef(_fd, _msg, __FILE__, __LINE__)
  534.  
  535. /**
  536.  */
  537. /*@unused@*/
  538. /*@only@*/ /*@null@*/
  539. FD_t fdNew (const char * msg)
  540.     /*@globals fileSystem @*/
  541.     /*@modifies fileSystem @*/;
  542. #define    fdNew(_msg)        fdio->_fdnew(_msg, __FILE__, __LINE__)
  543.  
  544. /**
  545.  */
  546. int fdWritable(FD_t fd, int secs)
  547.     /*@globals errno, fileSystem @*/
  548.     /*@modifies fd, errno, fileSystem @*/;
  549.  
  550. /**
  551.  */
  552. int fdReadable(FD_t fd, int secs)
  553.     /*@globals errno @*/
  554.     /*@modifies fd, errno @*/;
  555. /*@=exportlocal@*/
  556.  
  557. /**
  558.  * Insure that directories in path exist, creating as needed.
  559.  * @param path        diretory path
  560.  * @param mode        directory mode (if created)
  561.  * @param uid        directory uid (if created), or -1 to skip
  562.  * @param gid        directory uid (if created), or -1 to skip
  563.  * @return        0 on success, errno (or -1) on error
  564.  */
  565. int rpmioMkpath(const char * path, mode_t mode, uid_t uid, gid_t gid)
  566.     /*@globals h_errno, fileSystem, internalState @*/
  567.     /*@modifies fileSystem, internalState @*/;
  568.  
  569. /**
  570.  * Escape isspace(3) characters in string.
  571.  * @param s             string
  572.  * @return              escaped string
  573.  */
  574. char * rpmEscapeSpaces(const char * s);
  575.  
  576. /**
  577.  * FTP and HTTP error codes.
  578.  */
  579. /*@-typeuse@*/
  580. typedef enum ftperrCode_e {
  581.     FTPERR_NE_ERROR        = -1,    /*!< Generic error. */
  582.     FTPERR_NE_LOOKUP        = -2,    /*!< Hostname lookup failed. */
  583.     FTPERR_NE_AUTH        = -3,    /*!< Server authentication failed. */
  584.     FTPERR_NE_PROXYAUTH        = -4,    /*!< Proxy authentication failed. */
  585.     FTPERR_NE_CONNECT        = -5,    /*!< Could not connect to server. */
  586.     FTPERR_NE_TIMEOUT        = -6,    /*!< Connection timed out. */
  587.     FTPERR_NE_FAILED        = -7,    /*!< The precondition failed. */
  588.     FTPERR_NE_RETRY        = -8,    /*!< Retry request. */
  589.     FTPERR_NE_REDIRECT        = -9,    /*!< Redirect received. */
  590.  
  591.     FTPERR_BAD_SERVER_RESPONSE    = -81,    /*!< Bad server response */
  592.     FTPERR_SERVER_IO_ERROR    = -82,    /*!< Server I/O error */
  593.     FTPERR_SERVER_TIMEOUT    = -83,    /*!< Server timeout */
  594.     FTPERR_BAD_HOST_ADDR    = -84,    /*!< Unable to lookup server host address */
  595.     FTPERR_BAD_HOSTNAME        = -85,    /*!< Unable to lookup server host name */
  596.     FTPERR_FAILED_CONNECT    = -86,    /*!< Failed to connect to server */
  597.     FTPERR_FILE_IO_ERROR    = -87,    /*!< Failed to establish data connection to server */
  598.     FTPERR_PASSIVE_ERROR    = -88,    /*!< I/O error to local file */
  599.     FTPERR_FAILED_DATA_CONNECT    = -89,    /*!< Error setting remote server to passive mode */
  600.     FTPERR_FILE_NOT_FOUND    = -90,    /*!< File not found on server */
  601.     FTPERR_NIC_ABORT_IN_PROGRESS= -91,    /*!< Abort in progress */
  602.     FTPERR_UNKNOWN        = -100    /*!< Unknown or unexpected error */
  603. } ftperrCode;
  604. /*@=typeuse@*/
  605.  
  606. /**
  607.  */
  608. /*@-redecl@*/
  609. /*@observer@*/ const char *const ftpStrerror(int errorNumber)
  610.     /*@*/;
  611. /*@=redecl@*/
  612.  
  613. /**
  614.  */
  615. /*@unused@*/
  616. /*@dependent@*/ /*@null@*/ void * ufdGetUrlinfo(FD_t fd)
  617.     /*@modifies fd @*/;
  618.  
  619. /**
  620.  */
  621. /*@-redecl@*/
  622. /*@unused@*/
  623. /*@observer@*/ const char * urlStrerror(const char * url)
  624.     /*@globals h_errno, internalState @*/
  625.     /*@modifies internalState @*/;
  626. /*@=redecl@*/
  627.  
  628. /**
  629.  */
  630. /*@-exportlocal@*/
  631. int ufdCopy(FD_t sfd, FD_t tfd)
  632.     /*@globals fileSystem @*/
  633.     /*@modifies sfd, tfd, fileSystem @*/;
  634. /*@=exportlocal@*/
  635.  
  636. /**
  637.  */
  638. int ufdGetFile( /*@killref@*/ FD_t sfd, FD_t tfd)
  639.     /*@globals fileSystem, internalState @*/
  640.     /*@modifies sfd, tfd, fileSystem, internalState @*/;
  641.  
  642. /**
  643.  */
  644. /*@unused@*/ int timedRead(FD_t fd, /*@out@*/ void * bufptr, int length)
  645.     /*@globals fileSystem @*/
  646.     /*@modifies fd, *bufptr, fileSystem @*/;
  647. #define    timedRead    (ufdio->read)
  648.  
  649. /*@-exportlocal@*/
  650. /**
  651.  */
  652. /*@observer@*/ /*@unchecked@*/ extern FDIO_t fdio;
  653.  
  654. /**
  655.  */
  656. /*@observer@*/ /*@unchecked@*/ extern FDIO_t fpio;
  657.  
  658. /**
  659.  */
  660. /*@observer@*/ /*@unchecked@*/ extern FDIO_t ufdio;
  661.  
  662. /**
  663.  */
  664. /*@observer@*/ /*@unchecked@*/ extern FDIO_t gzdio;
  665.  
  666. /**
  667.  */
  668. /*@observer@*/ /*@unchecked@*/ extern FDIO_t bzdio;
  669.  
  670. /**
  671.  */
  672. /*@observer@*/ /*@unchecked@*/ extern FDIO_t fadio;
  673. /*@=exportlocal@*/
  674. /*@}*/
  675.  
  676. /*@unused@*/ static inline int xislower(int c) /*@*/ {
  677.     return (c >= 'a' && c <= 'z');
  678. }
  679. /*@unused@*/ static inline int xisupper(int c) /*@*/ {
  680.     return (c >= 'A' && c <= 'Z');
  681. }
  682. /*@unused@*/ static inline int xisalpha(int c) /*@*/ {
  683.     return (xislower(c) || xisupper(c));
  684. }
  685. /*@unused@*/ static inline int xisdigit(int c) /*@*/ {
  686.     return (c >= '0' && c <= '9');
  687. }
  688. /*@unused@*/ static inline int xisalnum(int c) /*@*/ {
  689.     return (xisalpha(c) || xisdigit(c));
  690. }
  691. /*@unused@*/ static inline int xisblank(int c) /*@*/ {
  692.     return (c == ' ' || c == '\t');
  693. }
  694. /*@unused@*/ static inline int xisspace(int c) /*@*/ {
  695.     return (xisblank(c) || c == '\n' || c == '\r' || c == '\f' || c == '\v');
  696. }
  697.  
  698. /*@unused@*/ static inline int xtolower(int c) /*@*/ {
  699.     return ((xisupper(c)) ? (c | ('a' - 'A')) : c);
  700. }
  701. /*@unused@*/ static inline int xtoupper(int c) /*@*/ {
  702.     return ((xislower(c)) ? (c & ~('a' - 'A')) : c);
  703. }
  704.  
  705. /** \ingroup rpmio
  706.  * Locale insensitive strcasecmp(3).
  707.  */
  708. int xstrcasecmp(const char * s1, const char * s2)        /*@*/;
  709.  
  710. /** \ingroup rpmio
  711.  * Locale insensitive strncasecmp(3).
  712.  */
  713. int xstrncasecmp(const char *s1, const char * s2, size_t n)    /*@*/;
  714.  
  715. #ifdef __cplusplus
  716. }
  717. #endif
  718.  
  719. #endif    /* H_RPMIO */
  720.